#include <lib.h>
#define dfs_get_file_path _dfs_get_file_path
#include <dfs.h>
#include <string.h>
#include <stdio.h>
#include <limits.h>
/*
 * Implementation of the library function for
 * the _dfs_get_file_path system call
 */

#if _ANSI
PUBLIC int dfs_get_file_path(const char *filealias,char *res)
#else
PUBLIC int dfs_get_file_path(filealias)
const char *filealias
#endif
{
	int r;
    char filepath[PATH_MAX];
    message m;
	
	memset(filepath,0,PATH_MAX);
	/* Set message to be sent */
	
	m.FILEALIAS = (char *)filealias;
    m.FILEALIASLEN = strlen(filealias);
    m.FILEPATH = filepath;
	memset(m.FILEPATH,0,sizeof(m.FILEPATH));
	
	/* Making the call */
	r = _syscall(DFS,DFS_GET_FILE_PATH,&m);
	if (r != OK) return (ERROR);
	
    /* Return results */
	memcpy(res,m.FILEPATH,strlen(m.FILEPATH));
	return OK;
}
